/*
 * BTree.h
 *
 *  Created on: Nov 21, 2011
 *      Author: kimi
 */

#ifndef BTREE_H_
#define BTREE_H_

#include "BTreeIndex.h"
#include "../BlocksFile.h"
#include <sstream>
#include <string>
#include "BlockRecordValue.h"

using namespace std;

class BTree {
public:

	BTree(string _filePath,unsigned long xBlockSize);
	virtual ~BTree();

	/**
	 *
	 */
	bool put(unsigned long key, char* data, unsigned long data_len);

	/**
	 *
	 */
	bool get(unsigned long key, char** data, unsigned long* data_len);


	/**
	 *
	 */
	bool has(unsigned long key);



private:

	bool remove(unsigned long key);


	unsigned long BTREE_MAX_NODE;;



	BTreeIndex<unsigned long, BlockRecordValue>* bTreeIndex;
	BlocksFile* bTreeData;
	string		filePath;
	unsigned long blockSize;
};

#endif /* BTREE_H_ */
